home *** CD-ROM | disk | FTP | other *** search
- Path: po.CWRU.Edu!mab22
- From: mab22@po.CWRU.Edu (Michael A. Balfour)
- Newsgroups: comp.lang.c
- Subject: Config files and ANSI C
- Date: 7 Feb 1996 23:31:01 GMT
- Organization: Case Western Reserve University, Cleveland, OH (USA)
- Message-ID: <4fbcnl$c2s@madeline.INS.CWRU.Edu>
- Reply-To: mab22@po.CWRU.Edu (Michael A. Balfour)
- NNTP-Posting-Host: kanga.ins.cwru.edu
-
-
- Are there any C (ANSI) routines available to read and write configuration
- files similar to an *.INI file? I'm sure this question is a common one,
- but I haven't found any answers to it yet. Here's an example of the
- type of file I'd like to read in:
-
- [table1]
- name="Employee"
- numFields=1
- [field1]
- name="SSN"
- type=NUMBER
- [end field1]
- [end table1]
-
- [table2]
- name="Company"
- numFields=1
-
- [field1]
- name="TIN"
- type=NUMBER
- [end field1]
- [end table2]
-
- As you can see, there's a need to access nested structures, as well as
- different data types.
-
- I've approached the problem as possibly reading in the entire file into
- a buffer and doing strcmp's, but that seems rather time-consuming. I've
- also seen someone refer to "XDR" as a means of writing cross-platform
- data files, but I can't find any information on that. Basically, I'm
- trying not to re-invent the wheel in a worse way if I can avoid it. :)
-
- If possible, please respond via e-mail as well as posting, because I
- don't have the chance to check this group often.
-
- Thanks,
-
- Mike Balfour
- --
- ----------------------------------+--------------------------------
- Mike Balfour, Partner | BS/MS Candidate - ECMP
- Overload Engineering | Case Western Reserve University
- "New Ideas for a Brighter Future" | Cleveland, OH
-